<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form action="注册成功.html" id="form1">
			用户名: <input type="text" name="username" id="input1" /><br />
			密码: <input type="text" name="password" id="input2" /><br />
			<input type="submit" />
			<input type="reset" />

		</form>

		<script>
			input1.onfocus = function() {

				var obj = event.target;
				obj.style.backgroundColor = "#ff0000";
			}


			input1.onblur = function() {
				var obj = event.target;
				obj.style.backgroundColor = "#ffffff";
			}


			input1.onchange = function() {
				console.log("内容改变了")
			}


			form1.onsubmit = function() {
				console.log("表单提交,检查表单内容是否正确")

				return true;
			}


			form1.onreset = function() {
				console.log("表单重置")
			}
		</script>
	</body>
</html>
